﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Laugh
{
    public static class EnumerableExtensions
    {
        public static void Each<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (T t in source)
                action(t);
        }

        public static void Each<T>(this IEnumerable<T> source, Action<T, int> action)
        {
            int index = 0;
            foreach (T item in source)
                action(item, index++);
        }
    }
}
